<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="newsDB.*,newsEntity.*,java.sql.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'MyJsp.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
	String uname=request.getParameter("uname");
	String upwd=request.getParameter("upwd");
	try{
		News_users user=News_usersDao.nd.signin(uname, upwd);		
		session.setAttribute("_name",user.getUname());
		session.setMaxInactiveInterval(300);
		Cookie c=new Cookie("loadName",user.getUname());
		c.setMaxAge(6000);
		response.addCookie(c);
		String ref=request.getHeader("REFERER");
		response.sendRedirect(ref);
	}catch(Exception e){
		session.setAttribute("message", "用户名或密码错误");
		String ref=request.getHeader("REFERER");
		response.sendRedirect(ref);
	}
 %>
  </body>
</html>


